package com.test.springboot3.springboot3testdemo1.controller;

import com.test.springboot3.springboot3testdemo1.dao.UserMapper;
import com.test.springboot3.springboot3testdemo1.entity.UserEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/8/5-下午3:21
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@RequiredArgsConstructor
@RestController
public class UserController {
  private final UserMapper userMapper;

  @GetMapping("/user/info/{id}")
  public UserEntity getUserInfoById(@PathVariable("id") long id) {
    final UserEntity user = userMapper.findById(id).orElse(null);
    return user;
  }
}
